package com.ruoyi.web.core.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @Author 季伟
 * 功能：
 */
@Configuration
@ConfigurationProperties(prefix = "upload")
public class WebConfig implements WebMvcConfigurer {
    @Value("${upload.path}")
    String fileLocation ;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        System.out.println(fileLocation);
        registry.addResourceHandler("/file/**")
                .addResourceLocations("file:"+fileLocation);
    }
}
